Optimal. Leaf size=229 \[ \frac {2 b^3 \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2} d}+\frac {2 b^3 \left (3 a^2-b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 \left (a^2-b^2\right )^{5/2} d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 229, normalized size of antiderivative = 1.00, number of steps
used = 13, number of rules used = 8, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.296, Rules used = {2976, 3855,
2727, 2743, 12, 2739, 632, 210} \begin {gather*} \frac {2 b^3 \left (3 a^2-b^2\right ) \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^2 d \left (a^2-b^2\right )^{5/2}}+\frac {2 b^3 \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{d \left (a^2-b^2\right )^{5/2}}+\frac {b^4 \cos (c+d x)}{a d \left (a^2-b^2\right )^2 (a+b \sin (c+d x))}-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 d (a+b)^2 (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 d (a-b)^2 (\sin (c+d x)+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 210
Rule 632
Rule 2727
Rule 2739
Rule 2743
Rule 2976
Rule 3855
Rubi steps
\begin {align*} \int \frac {\csc (c+d x) \sec ^2(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=\int \left (\frac {\csc (c+d x)}{a^2}-\frac {1}{2 (a+b)^2 (-1+\sin (c+d x))}-\frac {1}{2 (a-b)^2 (1+\sin (c+d x))}-\frac {b^3}{a \left (-a^2+b^2\right ) (a+b \sin (c+d x))^2}+\frac {3 a^2 b^3-b^5}{a^2 \left (a^2-b^2\right )^2 (a+b \sin (c+d x))}\right ) \, dx\\ &=\frac {\int \csc (c+d x) \, dx}{a^2}-\frac {\int \frac {1}{1+\sin (c+d x)} \, dx}{2 (a-b)^2}-\frac {\int \frac {1}{-1+\sin (c+d x)} \, dx}{2 (a+b)^2}+\frac {b^3 \int \frac {1}{(a+b \sin (c+d x))^2} \, dx}{a \left (a^2-b^2\right )}+\frac {\left (b^3 \left (3 a^2-b^2\right )\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )^2}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}+\frac {b^3 \int \frac {a}{a+b \sin (c+d x)} \, dx}{a \left (a^2-b^2\right )^2}+\frac {\left (2 b^3 \left (3 a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 \left (a^2-b^2\right )^2 d}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}+\frac {b^3 \int \frac {1}{a+b \sin (c+d x)} \, dx}{\left (a^2-b^2\right )^2}-\frac {\left (4 b^3 \left (3 a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 \left (a^2-b^2\right )^2 d}\\ &=\frac {2 b^3 \left (3 a^2-b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 \left (a^2-b^2\right )^{5/2} d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}+\frac {\left (2 b^3\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{\left (a^2-b^2\right )^2 d}\\ &=\frac {2 b^3 \left (3 a^2-b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 \left (a^2-b^2\right )^{5/2} d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}-\frac {\left (4 b^3\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{\left (a^2-b^2\right )^2 d}\\ &=\frac {2 b^3 \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2} d}+\frac {2 b^3 \left (3 a^2-b^2\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 \left (a^2-b^2\right )^{5/2} d}-\frac {\tanh ^{-1}(\cos (c+d x))}{a^2 d}+\frac {\cos (c+d x)}{2 (a+b)^2 d (1-\sin (c+d x))}+\frac {\cos (c+d x)}{2 (a-b)^2 d (1+\sin (c+d x))}+\frac {b^4 \cos (c+d x)}{a \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.62, size = 203, normalized size = 0.89 \begin {gather*} \frac {-\frac {2 \left (-4 a^2 b^3+b^5\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 \left (a^2-b^2\right )^{5/2}}+\sin \left (\frac {1}{2} (c+d x)\right ) \left (\frac {1}{(a+b)^2 \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}-\frac {1}{(a-b)^2 \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right )+\frac {-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {a b^4 \cos (c+d x)}{(a-b)^2 (a+b)^2 (a+b \sin (c+d x))}}{a^2}}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.70, size = 185, normalized size = 0.81
method | result | size |
derivativedivides | \(\frac {\frac {4 b^{3} \left (\frac {\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}+\frac {a b}{2}}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (4 a^{2}-b^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2} a^{2}}+\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}-\frac {1}{\left (a +b \right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {1}{\left (a -b \right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}}{d}\) | \(185\) |
default | \(\frac {\frac {4 b^{3} \left (\frac {\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}+\frac {a b}{2}}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+\frac {\left (4 a^{2}-b^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2} a^{2}}+\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}-\frac {1}{\left (a +b \right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {1}{\left (a -b \right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}}{d}\) | \(185\) |
risch | \(\frac {4 a^{4} {\mathrm e}^{2 i \left (d x +c \right )}-2 i a^{3} b \,{\mathrm e}^{3 i \left (d x +c \right )}-6 i a^{3} b \,{\mathrm e}^{i \left (d x +c \right )}-4 i a \,b^{3} {\mathrm e}^{3 i \left (d x +c \right )}+4 a^{2} b^{2}+2 b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+2 b^{4}}{\left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +2 a \,{\mathrm e}^{i \left (d x +c \right )}\right ) \left (a^{2}-b^{2}\right )^{2} d}+\frac {4 i b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i \left (\sqrt {a^{2}-b^{2}}\, a +a^{2}-b^{2}\right )}{b \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {i b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i \left (\sqrt {a^{2}-b^{2}}\, a +a^{2}-b^{2}\right )}{b \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,a^{2}}-\frac {4 i b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i \left (\sqrt {a^{2}-b^{2}}\, a -a^{2}+b^{2}\right )}{b \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}+\frac {i b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i \left (\sqrt {a^{2}-b^{2}}\, a -a^{2}+b^{2}\right )}{b \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,a^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a^{2} d}\) | \(526\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 437 vs.
\(2 (213) = 426\).
time = 0.90, size = 957, normalized size = 4.18 \begin {gather*} \left [\frac {2 \, a^{7} - 4 \, a^{5} b^{2} + 2 \, a^{3} b^{4} + 2 \, {\left (2 \, a^{5} b^{2} - a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )^{2} + {\left ({\left (4 \, a^{2} b^{4} - b^{6}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (4 \, a^{3} b^{3} - a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (-\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} - 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) - {\left ({\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left ({\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d \cos \left (d x + c\right )\right )}}, \frac {2 \, a^{7} - 4 \, a^{5} b^{2} + 2 \, a^{3} b^{4} + 2 \, {\left (2 \, a^{5} b^{2} - a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )^{2} - 2 \, {\left ({\left (4 \, a^{2} b^{4} - b^{6}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (4 \, a^{3} b^{3} - a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) - {\left ({\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left ({\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d \cos \left (d x + c\right )\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\csc {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\left (a + b \sin {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.61, size = 314, normalized size = 1.37 \begin {gather*} \frac {\frac {2 \, {\left (4 \, a^{2} b^{3} - b^{5}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} \sqrt {a^{2} - b^{2}}} + \frac {2 \, {\left (2 \, a^{4} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + b^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, a^{3} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 \, a^{2} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{5} - a^{3} b^{2} - a b^{4}\right )}}{{\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a\right )}} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.86, size = 2076, normalized size = 9.07 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________